#include <stdio.h>
/**
 * 计算阶乘
 */
int main() {
    int n=0;
    scanf("%d",&n);
    int i=1;
    int ret=1;
    int sum=0;
    while (i<=n){
        ret=ret*i;
        sum=sum+ret;
        i++;
    }
    printf("%d\n",ret);
    printf("%d\n",sum);

    return 0;
}
